<html>
<head>
<script>

if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
    testRunner.dumpChildFrames();
}

function navigate() {
    if (window.eventSender) {
        var a = document.getElementById("a");
        eventSender.mouseMoveTo(a.offsetLeft + 2, a.offsetTop + 2);
        eventSender.mouseDown();
        eventSender.mouseUp();
    }
}
function addChildFrame()
{
    if (!window.sessionStorage.getItem("childFrame")) {
        window.sessionStorage.childFrame = "true";
        document.body.innerHTML += '<iframe onload=\'setTimeout(navigate, 0);\' src=\'resources/empty-subframe.html\'></iframe>';
        return;
    }

    window.sessionStorage.removeItem("childFrame");
    document.body.innerHTML += '<iframe src=\'resources/pass-and-notify-done.html\'></iframe>';
}

</script>
</head>
<body onload="setTimeout(addChildFrame, 0)" onunload="return false;">
<a id="a" href="resources/empty-document-goes-back.html">Go forward then back.</a>
</body>
</html>
